<?php
/**
* Copyright 2009 Waag Society <http://www.waag.org>
* This file is part of Annotrax.
*
* Annotrax is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Annotrax is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Annotrax.
* If not, see http://www.gnu.org/licenses/gpl.html
*/

?>
<?php
/**
 * View file for /search/play
 */
$url 	= sprintf('%s?mode=%s&q=%s',$this->url(),$this->search->getQueryMode(), urlencode($this->search->query));
$pager  = $this->Pager( array(
	'limit'	=> $this->search->getLimit(),
	'offset' => $this->search->getOffset(),
	'max'	=> $this->search->getCount(),
	'uri'	=> $url
));
?>
<?php if( null !== $this->annotations && is_array( $this->annotations ) && count( $this->annotations ) > 0 ): ?>
<div class="section">
	<div class="floatLeft">
		<em><?php echo $this->translate( "Currently watching" )?></em>
		<h1><?php echo $this->translate("Playlist for ") ?> <em class="hilight">"<?php echo $this->search->query ?>"</em></h1>
	</div>
</div>
<div id="movieSection" class="section">
	<?php echo $this->Player( new Default_Model_Movie() ); ?>
	<div id="atAnnotationBrowser">
	<?php echo $this->annotationBrowser( $this->channels, $this->annotations ) ?>
	</div>
</div>
<div class="section">
	<div id="atAnnotationInfo">
		<?php /*
		<h1>
			<?php echo $this->translate("Annotation #") . $this->annotation->id ?>
			<?php echo $this->translate('for movie') ?>
			<a href="<?php echo $this->url(array('action' => 'play', 'id' => $this->annotation->movieId ), 'movie') ?>">
			<em><?php echo $this->movie->title ?></em></a>
		</h1>
			*/
		?>
		<div class="floatLeft">
			<img class="thumbnail" src="<?php echo $this->url( array('action' => 'thumbnail', 'id' => $this->annotation->movieId, 'timecode' => $this->annotation->getStart(false)), 'frame' ) ?>" />
		</div>
		<div class="floatLeft">
			<strong><span class="duration"><?php echo $this->translate("duration") ?> <?php echo $this->annotation->getDuration() ?></strong>
			<strong><?php echo $this->annotation->getStart() ?></strong>
			<div class='htmlcontent'>
				<dl>
				<?php if( strlen($this->annotation->comment) > 0 ): ?>
					<dt><?php echo $this->translate("Comment:") ?></dt>
					<dd><?php echo $this->annotation->comment ?></dd>
				<?php else: ?>
					<dt><?php echo $this->translate("Keywords:") ?></dt>
					<dd><?php echo join( ", ", $this->annotation->getKeywords() ) ?></dd>
				<?php endif; ?>
				</dl>
			</div>
		</div>
	</div>
</div>
<?php elseif( null !== $this->movies && is_array( $this->movies ) && count( $this->movies ) > 0 ): ?>
<?php // movie search results ?>
<div id="searchPager" class="section">
	<h1><?php echo $this->translate("Search results for") ?> <em class="hilight">"<?php echo $this->search->query ?>"</em></h1>
	<div>
		<?php echo $pager ?>
	</div>
</div>
<div id="archive-movieList" class="section">
	<?php echo $this->MovieList( $this->movies ); ?>
</div>
<div id="searchPager" class="section">
	<div>
		<?php echo $pager ?>
	</div>
</div>
<?php elseif( ($q = $this->search->query ) && ! empty( $q ) ): ?>
<div class="section">
	<h1><em>"<?php echo $this->search->query ?>"</em> <?php echo $this->translate("did not return any results") ?></h1>
	<p><?php echo $this->translate("Try something else? <em>\"bunny\"</em> perhaps?") ?><br/><br/></p>
</div>
<?php else: ?>
<div class="section">
	<p><em><?php echo $this->translate("You can search the archive here. Enter some keywords and see for yourself!") ?></em><br/><br/></p>
</div>
<?php endif;
